package com.kuizii.common.net;


import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageEncoder;

import java.util.List;

/**
 * @author renxiaodong
 */
public class DefaultMessageEncoder extends MessageToMessageEncoder<String> {


    @Override
    protected void encode(ChannelHandlerContext channelHandlerContext, String s, List<Object> list)  {
        System.out.println("发送消息："+s);
        channelHandlerContext.writeAndFlush(s);
    }

    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause)  {
        System.out.println("发生编码异常");
        cause.printStackTrace();
    }


}
